package com.drojian.demo4.communication;

import android.os.Bundle;
import android.widget.TextView;
import com.drojian.demo.R;
import rx.Subscription;
import rx.functions.Action1;

public class RxBusReceiveActivity extends RxBaseActivity {
    private TextView textView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.part4_activity_rx_bus_receive);

        textView = findViewById(R.id.tv1111111);
        recieveEvent();
    }

    private void recieveEvent() {
        Subscription subscription = RxBus.getDefault().toObservable(EventMessage.class).subscribe(new Action1<EventMessage>() {
            @Override
            public void call(EventMessage message) {
                textView.setText(message.toString());
            }
        });
        rxBusList.add(subscription);
    }


}